/*
 * Created by JFormDesigner on Sun Jun 17 14:10:59 GMT-03:00 2012
 */

package cin.ufpe.br.GDI.GUI;

import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;

/**
 * @author Bruna Carolina
 */
public class TelaVisualizarFotografia extends JFrame {
	public TelaVisualizarFotografia() {
		initComponents();
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.carregarListaFotos();
	}

	private void bt_okVisualizarFotoActionPerformed(ActionEvent e) {
		this.dispose();
	}
	
	private void carregarListaFotos(){
		Vector<String> fotos = new Vector<String>();
		
		fotos.add("Foto1");
		fotos.add("Foto2");
		
		lt_fotosMateria.setListData(fotos);
	}

	private void lt_fotosMateriaMouseClicked(MouseEvent e) {
		Object itemSelecionado = lt_fotosMateria.getSelectedValue();
		
		if(e.getClickCount() == 2){
			try{
				System.out.println(itemSelecionado.toString());
			}catch (Exception e1) {}
		}
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
		scrollPane1 = new JScrollPane();
		lt_fotosMateria = new JList();
		lb_fotoMateria = new JPanel();
		lb_visualizarFoto = new JLabel();
		bt_okVisualizarFoto = new JButton();

		//======== this ========
		setMinimumSize(new Dimension(800, 600));
		setTitle("Visualizar Fotografias");
		Container contentPane = getContentPane();
		contentPane.setLayout(null);

		//======== scrollPane1 ========
		{

			//---- lt_fotosMateria ----
			lt_fotosMateria.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					lt_fotosMateriaMouseClicked(e);
				}
			});
			scrollPane1.setViewportView(lt_fotosMateria);
		}
		contentPane.add(scrollPane1);
		scrollPane1.setBounds(50, 90, 245, 385);

		//======== lb_fotoMateria ========
		{
			lb_fotoMateria.setBorder(new EtchedBorder());
			lb_fotoMateria.setLayout(null);

			{ // compute preferred size
				Dimension preferredSize = new Dimension();
				for(int i = 0; i < lb_fotoMateria.getComponentCount(); i++) {
					Rectangle bounds = lb_fotoMateria.getComponent(i).getBounds();
					preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
					preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
				}
				Insets insets = lb_fotoMateria.getInsets();
				preferredSize.width += insets.right;
				preferredSize.height += insets.bottom;
				lb_fotoMateria.setMinimumSize(preferredSize);
				lb_fotoMateria.setPreferredSize(preferredSize);
			}
		}
		contentPane.add(lb_fotoMateria);
		lb_fotoMateria.setBounds(345, 90, 390, 385);

		//---- lb_visualizarFoto ----
		lb_visualizarFoto.setText("Visualizar Fotografias");
		lb_visualizarFoto.setFont(new Font("sansserif", Font.PLAIN, 14));
		contentPane.add(lb_visualizarFoto);
		lb_visualizarFoto.setBounds(new Rectangle(new Point(55, 25), lb_visualizarFoto.getPreferredSize()));

		//---- bt_okVisualizarFoto ----
		bt_okVisualizarFoto.setText("OK");
		bt_okVisualizarFoto.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				bt_okVisualizarFotoActionPerformed(e);
			}
		});
		contentPane.add(bt_okVisualizarFoto);
		bt_okVisualizarFoto.setBounds(new Rectangle(new Point(345, 495), bt_okVisualizarFoto.getPreferredSize()));

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for(int i = 0; i < contentPane.getComponentCount(); i++) {
				Rectangle bounds = contentPane.getComponent(i).getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
				preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
			}
			Insets insets = contentPane.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			contentPane.setMinimumSize(preferredSize);
			contentPane.setPreferredSize(preferredSize);
		}
		pack();
		setLocationRelativeTo(getOwner());
		// JFormDesigner - End of component initialization  //GEN-END:initComponents
	}

	// JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
	private JScrollPane scrollPane1;
	private JList lt_fotosMateria;
	private JPanel lb_fotoMateria;
	private JLabel lb_visualizarFoto;
	private JButton bt_okVisualizarFoto;
	// JFormDesigner - End of variables declaration  //GEN-END:variables
}
